<%-- 
    Document   : comment
    Created on : Dec 31, 2013, 2:46:09 AM
    Author     : Welcome
--%>

<%@page import="businesscard.DAO.LienheDAO"%>
<%@page import="bc.entity.Binhluan"%>
<%@page import="businesscard.DAO.BinhluanDAO"%>
<%@page import="bc.entity.Lienhe"%>
<%@page import="businesscard.DAO.UserDAO"%>
<%@page import="bc.entity.User"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<%
    int id_lienhe=Integer.parseInt(request.getParameter("id"));
    String cmt=request.getParameter("cmt");
    User user=(User)request.getSession().getAttribute("USER");
                String username=user.getUser();
                UserDAO userDAO=new UserDAO();    
                User user1=userDAO.getUser2(username);
                int id_user=user1.getIdUser();
                Lienhe lh=new Lienhe();
                lh.setIdLienhe(id_lienhe);
                BinhluanDAO blDAO=new BinhluanDAO();
                    Binhluan bl=new Binhluan(user1,lh,cmt);
                    blDAO.Save(bl);
                    Binhluan[] B = blDAO.getAllBinhluan(id_lienhe);
        
            for (int j = 0; j < B.length; j++) {
    %>
        <div class="hinhdaidien">
            <%
                int id = B[j].getUser().getIdUser();
                String link1 = "avatar/" + blDAO.getLinkHinh(id);
            %>
            <image src="<%=link1%>" style="width: 40px; height: 40px;"/>
        </div>
        <div id="usercmt"class="usercmt"><%=B[j].getBinhluan()%></div>     
 
    <%                    }
        
    %>
                   
   
    